<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>院办审批拒绝</title>
	<#include "/common/resource.ftl">
	<#include "/common/upload.ftl">
    <style>
        .layui-form-label{width:95px;}
        .layui-input-block{margin-left:125px;}
    </style>
	<script>
		$(function () {
			$.upload({
				renderId:'#select-attachment-button',
				uploadSuccess:function (file, data) {
					if (!data.success) {
						$.message(data.message);
						return;
					}
					var result = data.data[0];
					var content = '<div class="ui-attachment-item">';
					content += '<span class="ui-attachment-name">{name}({size})</span>';
					content += '<span class="fa fa-times-circle ui-attachment-remove"></span>';
					content += '<input type="hidden" name="attachmentIds" value="{attachmentId}"/>';
					content += '</div>';

					$(".ui-attachment-list .layui-input-block").append(content.format({attachmentId:result.id, name:result.name, size:FileUtils.formatSize(result.size)}));
					$(".ui-attachment-list").show();
				}
			});
			$(".ajax-form").unbind().submit(function () {
				try {
					var form = $(this);
					if (!form.valid()) {
						$.message("验证不通过，无法提交表单");
						return false;
					}

					form.formSubmit({
						callBack:function (data) {
							<#if (params.tag)??>
							history.go(-1);
							</#if>
						}
					});
				} catch (e) {
					console.log("表单提交错误：" + e);
				}
				return false;
			});
		});
	</script>
</head>
<body>
	<div class="ui-form">
		<form class="layui-form ajax-form" action="${params.contextPath}/web/outHospitalApprovalResult/contractSave" method="post">
			<input type="hidden" name="outHospitalId" value="${params.id}" />
			<input type="hidden" name="status" value="2" />
			<div class="layui-form-item">
                <label class="layui-form-label">拒绝原因<span class="ui-request">*</span></label>
                <div class="layui-input-block">
                    <textarea type="text" name="content" class="layui-textarea {required:true}" maxlength="500"></textarea>
                </div>
            </div>
			<div class="layui-form-item">
				<label class="layui-form-label">上传附件</label>
				<div class="layui-input-block">
					<a id="select-attachment-button">选择文件</a>
				</div>
			</div>
			<div class="layui-form-item ui-attachment-list">
				<label class="layui-form-label"></label>
				<div class="layui-input-block"></div>
			</div>
			<div class="layui-form-item">
				<div class="layui-input-block">
					<input type="submit" value="拒绝" class="layui-btn" />
				</div>
			</div>
		</form>
	</div>
</body>

</html>
